package com.fanghuaiming.seata.account.controller;

import com.fanghuaiming.seata.account.service.AccountService;
import java.math.BigDecimal;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/****
 * @description: 账户服务接口
 * @version:1.0.0
 * @author fanghuaiming
 * @data Created in 2020/11/27 下午2:00
 *
 */
@Slf4j
@RestController("account")
@RequestMapping("/account")
public class AccountController {

    /**
     * 账户服务
     */
    @Autowired
    private AccountService accountService;

    /**
     * @Description: 扣减账户余额
     *
     * @param:
     * @return:
     * @auther: fanghuaiming
     * @date: 2020/11/30 下午6:28
     * @version:1.0.0
     */
    @GetMapping("/decreaseAccount")
    public String decreaseAccount(Long userId, BigDecimal money) {
        accountService.decrease(userId,money);
        return "用户账户扣减金额成功";
    }
}
